<include file="public@header"/>
<style>
    .center{
        text-align: center
    }
</style>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('Mail/add')}">添加站点邮箱</a></li>
        <li class="active"><a href="{:url('Mail/mailboxList')}">我的邮箱</a></li>
    </ul>
    <div class="row">
        <div class="col-md-12">
            <table class="table table-hover table-bordered">
                <thead>
                <tr>
                    <th class="center">ID</th>
                    <th class="center">邮箱</th>
                    <th class="center">邮箱类型</th>
                    <th class="center">创建时间</th>
                    <th class="center">更新时间</th>
                    <th class="center">操作</th>
                </tr>
                </thead>
                <tbody>
                <foreach name="mailbox" item="vo">
                    <tr>
                        <td class="center">{$vo.id}</td>
                        <td class="center">{$vo.mailbox}</td>
                        <td class="center">{$vo.mailbox_type}</td>
                        <td class="center">{$vo.created_at}</td>
                        <td class="center">{$vo.updated_at}</td>
                        <td class="center">
                            <?php
                            echo ' <a style="text-decoration:none; color:green" href="' . 'dowload?id=' . $vo['id'] . '"' . ' onclick="return down();">
                            <button><b>下载邮件</b></button></a>&nbsp;&nbsp;';
                            ?>
                            <?php
                            echo ' <a style="text-decoration:none; color:green" href="' . 'mailList?id=' . $vo['id'] . '"' . '>
                            <button><b>查看邮件</b></button></a>&nbsp;&nbsp;';
                            ?>
                            <?php
                            echo ' <a style="text-decoration:none; color:green" href="' . 'update?id=' . $vo['id'] . '"' . '>
                            <button><b>更新</b></button></a>&nbsp;&nbsp;';
                            ?>
                            <?php
                            echo ' <a style="text-decoration:none;' . ' color:red" href="' . 'delete?id=' . $vo['id'] . '"' . ' onclick="return foo();">
                            <button><b>移除</b></button></a>&nbsp;&nbsp;';
                            ?>
                        </td>
                    </tr>
                </foreach>
                </tbody>
            </table>
        </div>
    </div>
</div>
<script>
function foo(){
    if(confirm("确认删除吗？操作不可逆")){
        return true;
    }
    return false;
}
function down(){
    if(confirm("确认下载最新邮件吗？")){
        return true;
    }
    return false;
}
</script>